{% extends "admin_base.html" %}
{% block title %}Posts Statistics{% endblock %}
{% block main %}
<div class="row">
    <!-- <h3>Post</h3><hr/> -->
    <h3>
        {{ post.title }}
        <a href="{{ url_for('blog_admin.post_statistics') }}" ><i class="fa fa-history" aria-hidden="true"></i></a>
    </h3><hr>
    <p><strong>Visits:</strong> {{ post_statistics.visit_count }}</p>
    <p><strong>Visits Verbose:</strong> {{ post_statistics.verbose_count_base }}</p>
    <p><strong>Detail:</strong> <a href="{{ url_for('main.post_detail', slug=post.slug) }}" target="_blank">{{ post.title }}</a></p>
</div>
<div class="row">
    <h3>Tracker</h3><hr/>
    <table class="table table-striped">
        <thead>
            <tr>
                <th>No.</th>
                <th>IP</th>
                <th>Agent</th>
                <th>Update</th>
            </tr>
        </thead>
        <tbody>
            {% for tracker in trackers.items %}
            <tr id="tracker-{{ tracker.id }}">
                <td>{{ loop.index }}</td>
                <td>{{ tracker.ip }}</td>
                <td>{{ tracker.user_agent }}</td>
                <td>{{ tracker.create_time.strftime('%Y-%m-%d %H:%M:%S') }}</td>
            </tr>
            {% else %}
            <tr><td colspan="4" style="text-align: left">No records yet</td></tr>
            {% endfor %}      
        </tbody>
    </table>
    {% import '_pagination.html' as pagination %}
    {{ pagination.render_pagination(trackers) }}
    <!-- </div> -->
    <!-- <div class="col-md-2">.col-md-2</div> -->
</div>
{% endblock %}
